
import urllib3
import json

def main(sql: str) -> dict:
    # 创建连接池
    http = urllib3.PoolManager()
    
    try:
        headers = {'Content-Type': 'application/json'}
        payload = json.dumps({'sql': sql}).encode('utf-8')
        
        # 发送POST请求
        response = http.request(
            'POST',
            'http://192.168.13.65:5000/execute',
            body=payload,
            headers=headers
        )
        
        # 解析响应数据
        data = json.loads(response.data.decode('utf-8'))
        print(data)
        return data
        
    except Exception as e:
        return str(e)

main("SELECT * FROM sys_user")